<%@page import="com.alisveris.pojo.UrunDetayPojo"%>
<%@page import="com.alisveris.pojo.Urun"%>
<%@page import="java.text.NumberFormat"%>
<%@page import="com.alisveris.dao.AlisVerisSepeti"%>
<%@page import="com.utility.Utility"%>
<%@page import="com.alisveris.dao.PagingController"%>
<%@page import="com.alisveris.pojo.UrunResimPojo"%>
<%@page import="org.apache.commons.lang3.StringUtils"%>
<%@ page language="java" import="java.util.*" %>
<%@ page language="java" import="java.io.*" %>
<%@ page language="java" import="com.login.*" %>
<%@ page contentType="text/html; charset=iso-8859-9"%>
<jsp:useBean id="urunDetayDao"  class="com.alisveris.dao.UrunDetayDao"/>

<html>
	<head>
	    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>Personel Web Page</title>	
        <link rel="stylesheet" href="/e_ticaret/css/general.css" type="text/css"/>	 
 	  
 	   <script type="text/javascript">
	 	  
 	     function goBack(pageNumber) {
	 		 window.location.href='/e_ticaret/anasayfa/index.jsp?pageNumber='+pageNumber;
	     }
 	        
 	     function sepete_at(urunFiyat,urunKod,urunMiktar,urunIsmi,product){ 	 
 	    	window.location.href = "/e_ticaret/alisveris/Add?urunFiyat="+urunFiyat+"&urunKod="+urunKod+"&urunMiktar="+urunMiktar+"&urunIsmi="+urunIsmi+"&product="+product;		    	      	 
 	     }
 	      
 	     function sepeteCikar(i,urunKod,product){
	    	window.location.href="/e_ticaret/alisveris/sepeteCikar?urun="+i+"&urunKod="+urunKod+"&product="+product+"&detay=detay";
	     }
 	     
 	   </script>
 	  
 	  
	</head>
    
    
	
	<body>
    <%ResourceBundle resource = ResourceBundle.getBundle("properties.bundle.Messages_tr");%>
	 <div id="conteyner">
		  <div id="header">
		
		             <div id="banner">
		             
		                 <div class="banner_left" style="text-indent: -30000px;">1</div>
		                 <div  class="banner_center"><img  src="/e_ticaret/images/banner.jpg" width="100%" height="100%"></img></div>
		                 <div class="banner_right" style="text-indent: -30000px;">3</div>
		               
		             </div>
		
		
						 <div class="menu">				 
					 
		                        <ul>
		                          <li><a href="/e_ticaret/anasayfa/index.jsp">Home</a></li>
								  <li><a href="/e_ticaret/anasayfa/about.jsp">About</a></li>								
								  <li><a href="/e_ticaret/anasayfa/contact.jsp">Contact</a></li>
								</ul>
					 
					     </div>
					
					
					
			</div>
			
			<div id="body">
			            <% 
			              String urunKod=request.getParameter("urunKod");
			              UrunDetayPojo urunInfo = urunDetayDao.getRetrieveProductInfo(urunKod);		              
			              
			              String images=request.getParameter("product"); 
			              
			              
			              int pageNumber= Utility.nullIntconv(request.getParameter("pageNumber"));
			              
			              %>
			             
			        
			          <div class="body_left">
			        
			             <div class="body_left_top" >
			                <img src="/e_ticaret/images/sepet_logo.jpg" width="100%"/>
			                <p><%=resource.getString("sepete.urun.atiniz")%></p> 
			             </div>
					             <div class="body_left_center">
					             
					                <%	
					                
					             // Alışveriş sepetinin session'dan çekilmesi
					                AlisVerisSepeti sepet =   (AlisVerisSepeti) session.getAttribute("AlisVerisSepeti");    
					                 

					                // Kullanıcı eğer sepet oluşturmamışsa 
					                // yeni bir sepet oluşturma
					                if (sepet == null) {
					                    sepet = new AlisVerisSepeti();
					             	    session.setAttribute("AlisVerisSepeti", sepet);
					                }
					                
					                // Ürün fiyatını formatlı yazmak için 
					                // gerekli referansın oluşturulması	  
					                  NumberFormat f = NumberFormat.getCurrencyInstance(new Locale("tr", "TR"));

					                // Sepetteki ürünlerin alınması
					                 Vector urunler = sepet.getUrunler();   
					                   
					                 int urunSayisi = urunler.size();
					           	  
					           	  for (int i = 0; i < urunSayisi; i++) {
					           	     Urun urun = (Urun) urunler.elementAt(i);
					           		 
					           	     // Seçilen ürün bilgilerinin tablo
					           		 // içine yerleştirilmesi				           	   
					                %>
					                
					                <table>
					                 
					                  <tr>
					                      <td class="sepet_row">				                  
					                         <span class="sepet_urun_text"><p><%=urun.getIsmi()%></p></span>				                      
					                      </td> 
					                      
					                      <td class="sepet_row">				                           
					                         <input type="button" value="Sepetten Cikar"  class="sepetecikar_button" onclick="sepeteCikar('<%=i%>','<%=urunInfo.getKod()%>','<%=images%>');" />					                        
	                                     </td>
	                                 </tr>
					                  
					                </table>
					            
					                
					                
					            <%}%>        
					             					                
					                 <%if(urunler.size()==0){%>
					                <p><%=resource.getString("sepet.bos")%><p/>
					                <%}else{%>
					                  <form  action="/e_ticaret/anasayfa/musteriBilgileri.jsp" method="post"  > 
					                   <input type="submit" value="Onayla" class="sepetOnay"/>
					                  </form> 
					                <%}%>
					                
					                
					                
					               
					             </div>
			             <div class="body_left_bottom"><img src="/e_ticaret/images/e-ticaret.png" width="100%" height="100%"/></div>

			        </div>
			        
			        
			        <div class="body_center">
			              
			            
			        
			              <div class="body_center_detail">
			                  
							  <a href="#"><img src=<%=images%>></a>						      						     
						  </div>
						  
						  <div class="body_center_detail_message">						      
						      <%=urunInfo.getProductAbout()%>					  
						  </div>
						  
						  
						  <div class="body_center_detail_go_back">
						    <input type="button" value="Go Back" id="goBack" name="goBack" class="alisveris_button" onclick="goBack('<%=pageNumber%>');" />
						  
						    <input type="button" value="Sepete At" id="goBack" name="goBack" class="alisveris_button" onclick="sepete_at('<%=urunInfo.getFiyat()%>','<%=urunInfo.getKod()%>','<%=urunInfo.getMiktar()%>','<%=urunInfo.getIsmi()%>','<%=images%>');" />		         
			              </div>
			         </div>
			        		        
			           <div class="body_right">			         
			             <div class="body_right_top">
			                  <div class="body_right_top_top" style="text-indent: -30000px">1</div>
			                  <div class="body_right_top_middle">
			                    <form id="loginForm" name="loginForm" action="/e_ticaret/login.jsp"   method="post" >
			                     <%		                     
			                        String username =(String)session.getAttribute("username");		                     
			                        String password = (String)session.getAttribute("password");			                 		                     			                    
			                     %>
			                     
			                     <%if(username==null && password==null){%>
			                     <input type="text" id="userId" name="userId"  placeholder="Email"/><br/>
			                     <input type="text" id="passwordId" name="passwordId"  placeholder="Password"/><br/>
			                     <input type="submit" value="Login" id="loginId" name="loginId" class="login_logout"  />
			                     <%}else{%>	
			                      <br/><br/><br/>		                     			                      
			                      <input type="submit" value="Logout" id="logoutId" class="logoutButton" name="logoutId"  />	
			                     <p align="center" class="logoutUsername"><%=username%></p >                    			                     			                     
			                     
			                      <%}%>
			                      
			                    
			                    </form>
			                     
			                  </div>
			                  <div class="body_right_top_bottom">
			                    <br/><br/>
			                    <%			                    
			                    String message = (String)request.getAttribute("message");			                    
			                    if(!StringUtils.isBlank(message)){ 			                    
			                    %>
			                    <p align="center" ><%=message%></p >  
			                    <%}%>		                  
			                  </div>
			             </div>
			             <div class="body_right_middle"><img src="/e_ticaret/images/sale_advert.jpg" width="100%" height="100%"/></div>
			             <div class="body_right_bottom"><img src="/e_ticaret/images/sale.jpg" width="100%" height="100%"/></div>	
			         </div>

			</div>
				<%	
					String footer =resource.getString("rezarvasyon.alt.baslik");																										
                %>			
				<div id="footer">
			  
			  
				  <div class="parentFooter">
				      <div class="childFooter">
				          <p><%=footer%></p>
				       </div>			      
				   </div>
			  
			   
			    </div>
			
		</div>
			
	</body>
</html>